From 86ecdc7a4403c0e0e0355555b71e397f155111d2 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Wed, 16 Dec 2015 11:37:49 -0500 Subject: [PATCH] model button: Document iconic layout Document how the CSS nodes look if iconic is TRUE. Add a .model style class for this case and use it in Adwaita. --- gtk/gtkmodelbutton.c | 12 ++++++++++++ gtk/theme/Adwaita/_common.scss | 2 +- gtk/theme/Adwaita/gtk-contained-dark.css | 6 +++--- gtk/theme/Adwaita/gtk-contained.css | 6 +++--- 4 files changed, 19 insertions(+), 7 deletions(-) diff --git a/gtk/gtkmodelbutton.c b/gtk/gtkmodelbutton.c index 727ea67f6c..f536afe54d 100644 --- a/gtk/gtkmodelbutton.c +++ b/gtk/gtkmodelbutton.c @@ -133,6 +133,16 @@ * * The subnode is positioned before or after the content nodes and gets the * .left or .right style class, depending on where it is located. + * + * |[ + * button.model + * ├── + * ╰── check + * ]| + * + * Iconic model buttons (see #GtkModelButton::iconic) change the name of + * their main node to button and add a .model style class to it. The indicator + * subnode is invisible in this case. */ struct _GtkModelButton @@ -435,6 +445,7 @@ gtk_model_button_set_iconic (GtkModelButton *button, if (iconic) { gtk_css_node_set_name (widget_node, I_("button")); + gtk_css_gadget_add_class (button->gadget, "model"); gtk_css_gadget_add_class (button->gadget, "image-button"); gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NORMAL); gtk_css_node_set_visible (indicator_node, FALSE); @@ -442,6 +453,7 @@ gtk_model_button_set_iconic (GtkModelButton *button, else { gtk_css_node_set_name (widget_node, I_("modelbutton")); + gtk_css_gadget_remove_class (button->gadget, "model"); gtk_css_gadget_remove_class (button->gadget, "image-button"); gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE); gtk_css_node_set_visible (indicator_node, diff --git a/gtk/theme/Adwaita/_common.scss b/gtk/theme/Adwaita/_common.scss index 94fadadd31..34c6101854 100644 --- a/gtk/theme/Adwaita/_common.scss +++ b/gtk/theme/Adwaita/_common.scss @@ -1561,7 +1561,7 @@ popover.background { transition: none; } - button.image-button { + button.model.image-button { padding: 0px; } diff --git a/gtk/theme/Adwaita/gtk-contained-dark.css b/gtk/theme/Adwaita/gtk-contained-dark.css index 840f19e118..e60a047bda 100644 --- a/gtk/theme/Adwaita/gtk-contained-dark.css +++ b/gtk/theme/Adwaita/gtk-contained-dark.css @@ -2174,9 +2174,9 @@ popover.background { .titlebar popover.background button.titlebutton:hover { text-shadow: none; transition: none; } - popover.background button.image-button, popover.background headerbar button.titlebutton, headerbar popover.background button.titlebutton, - popover.background .titlebar button.titlebutton, - .titlebar popover.background button.titlebutton { + popover.background button.model.image-button, popover.background headerbar button.model.titlebutton, headerbar popover.background button.model.titlebutton, + popover.background .titlebar button.model.titlebutton, + .titlebar popover.background button.model.titlebutton { padding: 0px; } .csd popover.background.touch-selection, .csd popover.background.magnifier, popover.background.touch-selection, popover.background.magnifier { border: 1px solid rgba(255, 255, 255, 0.1); } diff --git a/gtk/theme/Adwaita/gtk-contained.css b/gtk/theme/Adwaita/gtk-contained.css index d50b5d9aa9..d9d59727a9 100644 --- a/gtk/theme/Adwaita/gtk-contained.css +++ b/gtk/theme/Adwaita/gtk-contained.css @@ -2180,9 +2180,9 @@ popover.background { .titlebar popover.background button.titlebutton:hover { text-shadow: none; transition: none; } - popover.background button.image-button, popover.background headerbar button.titlebutton, headerbar popover.background button.titlebutton, - popover.background .titlebar button.titlebutton, - .titlebar popover.background button.titlebutton { + popover.background button.model.image-button, popover.background headerbar button.model.titlebutton, headerbar popover.background button.model.titlebutton, + popover.background .titlebar button.model.titlebutton, + .titlebar popover.background button.model.titlebutton { padding: 0px; } .csd popover.background.touch-selection, .csd popover.background.magnifier, popover.background.touch-selection, popover.background.magnifier { border: 1px solid rgba(255, 255, 255, 0.1); } -- 2.30.2